package com.bstek.bdf2.core.orm.config;

import com.bstek.bdf2.core.orm.DataSourceRegister;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import javax.sql.DataSource;

/**
 * @Title: DataSourceRegisterConfig
 * @Package: com.bstek.bdf2.core.orm
 * @Description:
 * @Author: zxq
 * @Date: 2024/1/2 - 20:29
 */
@Configuration
//@ConditionalOnBean(DataSourceRegister.class)
public class DataSourceRegisterConfig {

    @Autowired
    private DataSource dataSourceOne;

    @Bean
    public DataSourceRegister dataSourceRegister() {
        DataSourceRegister dataSourceRegister = new DataSourceRegister();
        dataSourceRegister.setDataSource(dataSourceOne);
        dataSourceRegister.setName("bstek-mysql");
        dataSourceRegister.setAsDefault(true);
        return dataSourceRegister;
    }




}
